package com.manong.controller;

import com.manong.entity.SysFinancialExpenses;
import com.manong.service.SysFinancialExpensesService;
import com.manong.utils.Result;
import com.manong.vo.CommonReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/financialExpenses")
public class SysFinancialExpensesController {

    private final SysFinancialExpensesService sysFinancialExpensesService;

    /**
     * 财务支出列表查询
     * @param commonReqVo
     * @return
     */
    @PostMapping("/list")
    public Result list(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysFinancialExpensesService.listAll(commonReqVo)).message("用户财务支出信息查询成功");
    }
    @PostMapping("/chart")
    public Result chart(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysFinancialExpensesService.chart(commonReqVo)).message("财务支出已更新");
    }

    @PostMapping("/delete")
    public Result delete(@RequestBody CommonReqVo commonReqVo) {
        return Result.ok(sysFinancialExpensesService.delete1(commonReqVo)).message("用户财务支出信息删除成功");
    }

    @PostMapping("/save")
    public Result save(@RequestBody SysFinancialExpenses sysFinancialExpenses) {
        return Result.ok(sysFinancialExpensesService.save1(sysFinancialExpenses)).message("用户财务支出信息更新成功");
    }

}
